<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel='stylesheet' type='text/css' media='screen' href='main.css'>
    <script src='main.js'></script>
</head>
<body>
    
</body>
<script>
    // 1. 小九九（九九乘法表）
console.log("1. 九九乘法表：");
for (let i = 1; i <= 9; i++) {
    let line = "";
    for (let j = 1; j <= i; j++) {
        line += `${j}×${i}=${i*j}\t`;
    }
    console.log(line);
}    
</script>
<script>
    // 2. 金字塔
console.log("\n2. 金字塔：");
const rows = 5;
for (let i = 1; i <= rows; i++) {
    let space = " ".repeat(rows - i);
    let stars = "*".repeat(2 * i - 1);
    console.log(space + stars);
}    
</script>
<script>
    // 3. 打印直角三角形
console.log("\n3. 直角三角形：");
for (let i = 1; i <= 5; i++) {
    console.log("*".repeat(i));
}    
</script>
<script>
    // 4. 复利计算
console.log("\n4. 复利计算：");
let principal = 10000;
const rate = 0.003;
const years = 5;
for (let i = 0; i < years; i++) {
    principal += principal * rate;
}
console.log(`5年后的本金是: ${principal.toFixed(2)}元`);    
</script>
<script>
    // 5. 兔子繁殖问题（斐波那契数列）
console.log("\n5. 兔子繁殖问题：");
const months = 12;
let fib = [1, 1];
for (let i = 2; i < months; i++) {
    fib[i] = fib[i - 1] + fib[i - 2];
}
console.log(`一年后兔子的对数是: ${fib[months - 1]}`);    
</script>
<script>
    // 6. 打印菱形
console.log("\n6. 菱形：");
const size = 5;
// 上半部分
for (let i = 1; i <= size; i++) {
    let space = " ".repeat(size - i);
    let stars = "*".repeat(2 * i - 1);
    console.log(space + stars);
}
// 下半部分
for (let i = size - 1; i >= 1; i--) {
    let space = " ".repeat(size - i);
    let stars = "*".repeat(2 * i - 1);
    console.log(space + stars);
}    
</script>
</html>